/*
* introduction: This code is just a library object.
* thanks-to https://github.com/maryrosecook/littlelisp
*
* author ufo
* email ufo5260987423@163.com
* date 28 March 2014 
*
* quality Firefox 28.0 +ubuntu 12.04 accept
*/
var library = {
	'first': function(x) {
		return x[0];
	},
	'rest': function(x) {
		return x.slice(1);
	},
	'print': function(x) {
		console.log(x);
		return x;
	},
	'atom':function(x){return x!=undefined;},
	'true':true,
	'false':false,
	'reduce':function(a,b,c){return (c?c:b).reduce(a,(c?b:c)); },
	'map':function(a,b){return b.map(a)},
	'==': function (a, b) { return a == b; },
	'!=': function (a, b) { return a != b; },
	'<': function (a, b) { return a < b; },
	'<=': function (a, b) { return a <= b; },
	'>': function (a, b) { return a > b; },
	'>=': function (a, b) { return a >= b; },
	'+': function (a, b) { return (a?a:0) + (b?b:0); },
	'-': function (a, b) { return b?a-b:(a?-a:0); },
	'*': function (a, b) { return (a?a:1)*(b?b:1); },
	'/': function (a, b) { return a / b; },
	'%': function (a, b) { return a % b; },
	'^': function (a, b) { return Math.pow(a, b); }
};
